package cn.hj.domain.strategy.model.valobj;

import cn.hj.domain.strategy.service.rule.filter.factory.DefaultLogicFactory;
import cn.hj.types.common.Constants;
import lombok.Builder;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 策略抽奖规则指对象：值对象，没有唯一id，仅限于从数据库查询对象
 */
@Builder
@Getter
public class StrategyAwardRuleModelVO {

    private String ruleModels;

    private String[] raffleCenterRuleModelList(){
        List<String> ruleModelsList = new ArrayList<>();
        String[] ruleModelValues = ruleModels.split(Constants.SPACE);
        for (String ruleModelValue : ruleModelValues) {
            if (DefaultLogicFactory.LogicModel.isCenter(ruleModelValue)){
                ruleModelsList.add(ruleModelValue);
            }
        }
        return ruleModelsList.toArray(new String[0]);
    }
}
